UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e4QP0nHfj6rXhbgKezUoOKkrw7ZQgivW90fa7vGFV/A=' 
WHERE 
  key_id = '584a0f4fc9ee9751d801e578e8b27eab47828199f0c1422b7952f583810c8d93' 
  AND (
    token = 'e4QP0nHfj6rXhbgKezUoOKkrw7ZQgivW90fa7vGFV/A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035