UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U4x9M2nQvom6a/zuxrEBOmDQpAH2pI/rfWWMxu1yjVo=' 
WHERE 
  key_id = '2346fc5bca554488557a9033599d3d7bafd056de9694b25a6eabf8946f45e140' 
  AND (
    token = 'U4x9M2nQvom6a/zuxrEBOmDQpAH2pI/rfWWMxu1yjVo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019