UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4w+DT3Q/4mP+z9DtsG6uYR7S2ZJ4AX5vEwMmVqZsS+A=' 
WHERE 
  key_id = '835901d774bc2e3d28f91d861575292edc38a0f951c8e1886b4baf488cb414ce' 
  AND (
    token = '4w+DT3Q/4mP+z9DtsG6uYR7S2ZJ4AX5vEwMmVqZsS+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053