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

Query time 0.00024