UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fJjCOiB/+oDchcydLDYRqNmiLeA/o/JD0UnwivNTos8=' 
WHERE 
  key_id = '8b287e490d95015e2fb7baeaad6c6dc5331cd4321c00616e05f5eb4e91b394c1' 
  AND (
    token = 'fJjCOiB/+oDchcydLDYRqNmiLeA/o/JD0UnwivNTos8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032