UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7MuDgCadWOcUzkm7nliW7m4Aahot1nxystOO5YB/bNU=' 
WHERE 
  key_id = 'f191ec31f3f09c6c30d2f4aeab34598d6e1bc7dc6ba4549b338b3315fb0ae5fe' 
  AND (
    token = '7MuDgCadWOcUzkm7nliW7m4Aahot1nxystOO5YB/bNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044