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

Query time 0.00023