UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QfRhb7EuvpwIbDvRztwub5XV4EojMR9BDSE8aloOJQE=' 
WHERE 
  key_id = 'aaaa56281204e7aa85a8d5ae5ca4bf67e176a987370749340d98c9d13d423be7' 
  AND (
    token = 'QfRhb7EuvpwIbDvRztwub5XV4EojMR9BDSE8aloOJQE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051