UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GOU5aT2D8BpufBZxgCjNXOOnPZw66k31jBfGPdPnWCQ=' 
WHERE 
  key_id = 'b345232558c1280c9387bdc0b92bf60ad19533da37136799712f97eb3b836f71' 
  AND (
    token = 'GOU5aT2D8BpufBZxgCjNXOOnPZw66k31jBfGPdPnWCQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035