UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dlN8XtJtzFK1dnBrwG+EYB3QAXX2/pnzlEkvNKsmbIg=' 
WHERE 
  key_id = 'eefc78acd0385934a80bbc6a655b6525bb10d3b386f56284d66fbc81d1f79b6c' 
  AND (
    token = 'dlN8XtJtzFK1dnBrwG+EYB3QAXX2/pnzlEkvNKsmbIg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044