UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fQjPrtd+0Mp0mnQCDANARAs8QiBaVrtZNzKahqKFAPc=' 
WHERE 
  key_id = 'c4e65bb52815ee8dfe3c94f4b0159ce292ffc63f6d5f743d41346438d727378c' 
  AND (
    token = 'fQjPrtd+0Mp0mnQCDANARAs8QiBaVrtZNzKahqKFAPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027