UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bRPLPixAIngL+KaQy7Z/TxsyK8e2etogXmpQEf382AU=' 
WHERE 
  key_id = '0b7c07ac5530f8f3c340f271f54c745b8171207f933193e2fc478c5f0d213623' 
  AND (
    token = 'bRPLPixAIngL+KaQy7Z/TxsyK8e2etogXmpQEf382AU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032