UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GDuxcF5ka8nRzzPNxHJrj630ZBrDTbf/u5dHLqxRP6s=' 
WHERE 
  key_id = '3ebc97c36d805b408943a0e90d4726503663dbcb34df59decfe3b10af134943c' 
  AND (
    token = 'GDuxcF5ka8nRzzPNxHJrj630ZBrDTbf/u5dHLqxRP6s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025