UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MRvX4G9hgCz13tlu8nI+KuiIJOZHqwV4XOEERNs5lCQ=' 
WHERE 
  key_id = 'b759aa5337593173e761462495e42fe5a19712e80efcba6de82baa0832ddebb8' 
  AND (
    token = 'MRvX4G9hgCz13tlu8nI+KuiIJOZHqwV4XOEERNs5lCQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052