UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qNRcCbC5O3zbNqWBRdYkCyG2GdsIb/Z13ho/N9nXl0c=' 
WHERE 
  key_id = '540b8fabe5393127426aec3eadc95c8ac1eee72179506e90dbdca8e5187142e6' 
  AND (
    token = 'qNRcCbC5O3zbNqWBRdYkCyG2GdsIb/Z13ho/N9nXl0c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038