UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CtNj9+FxpQvxyZDlSfs68zTyYIqO6btyVHWt4WQTsEE=' 
WHERE 
  key_id = '8d96122ce0e2395e1a4785658e4828f09567f4351b636e1427220aa5e64ccee6' 
  AND (
    token = 'CtNj9+FxpQvxyZDlSfs68zTyYIqO6btyVHWt4WQTsEE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051