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

Query time 0.00034