UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V2hjmMknVFGie9mF1Djjz+OcnOCwX+SCP9G+11zKrBk=' 
WHERE 
  key_id = 'ba3e8ff7a5de25a51660df637ccd37abd875463fb1add4497d262724ef50db93' 
  AND (
    token = 'V2hjmMknVFGie9mF1Djjz+OcnOCwX+SCP9G+11zKrBk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029