UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2q/3eqE2YYaUGheRQSQRrPrdJuxfA0ecjrlL173ECmQ=' 
WHERE 
  key_id = '1a0049c757afc6d9a4addcc523b1110b28cd4b3facf9a7c7ce362b07815eeaa8' 
  AND (
    token = '2q/3eqE2YYaUGheRQSQRrPrdJuxfA0ecjrlL173ECmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037