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

Query time 0.00032