UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v84UFZPkwOerDszmdLZtwbL+6aUpIRp89t6y8hGjhBk=' 
WHERE 
  key_id = 'c0b3d31e42c2473479d27e3ddc85549c21bec9625baebf327491ad8c44dd2612' 
  AND (
    token = 'v84UFZPkwOerDszmdLZtwbL+6aUpIRp89t6y8hGjhBk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048