UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l+5QstG2eqLPa1hjiUqRDJ5gw9GM6HLNn0X/lh0HAso=' 
WHERE 
  key_id = 'ceba50f5316e5c057f274a0ac9a746d861a36d2d666963e6836c812544130bac' 
  AND (
    token = 'l+5QstG2eqLPa1hjiUqRDJ5gw9GM6HLNn0X/lh0HAso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027