UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oPLEIKZSm+RIHF3BhQQpDkx3eNqFKWLScLNGrLp+HPs=' 
WHERE 
  key_id = '2f22aa591d6567d99fe97fd22fcc6d52e4972be02e73d079704bae25a7746e80' 
  AND (
    token = 'oPLEIKZSm+RIHF3BhQQpDkx3eNqFKWLScLNGrLp+HPs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053