UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/AV9A44uWXyy27Ey1senjLA9ec4t+1MGa+gINsqe16k=' 
WHERE 
  key_id = 'ae6a2c0a51105d3a919a50f972918e9b366128cccef3fb876df9e98a46aca766' 
  AND (
    token = '/AV9A44uWXyy27Ey1senjLA9ec4t+1MGa+gINsqe16k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031