UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BTjlsOab7pwOZ92baoq+MoC68HcWQbcQ9qOXbRQ5GNk=' 
WHERE 
  key_id = '10266276adc2b2eadfe340fecf239d537db23071c6bf80bc91eb6c426caa779e' 
  AND (
    token = 'BTjlsOab7pwOZ92baoq+MoC68HcWQbcQ9qOXbRQ5GNk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035