UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v/7hZgQAihZDNC3crtLZoCFplw69ENZpXH/hCaLnghA=' 
WHERE 
  key_id = 'db0eb4b8810be601121c7c977cf66b09b6e59811b856f8197ae8e22f7f4ee461' 
  AND (
    token = 'v/7hZgQAihZDNC3crtLZoCFplw69ENZpXH/hCaLnghA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037