UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EawRVIHJ1aeXK3ME/8k/XoA0x3Ck8qn+rsDtC49y+bY=' 
WHERE 
  key_id = 'd4270132c01893840a5e66d3d103856359e257bc49767bb179f27afb1c39483b' 
  AND (
    token = 'EawRVIHJ1aeXK3ME/8k/XoA0x3Ck8qn+rsDtC49y+bY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029