UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4aNKkLN+F3fgtkcAHDq0DsdJT4ZuZElCQBc79ugjRSI=' 
WHERE 
  key_id = 'bd69f789419f6397739cb18a2c491a6794d74217c1cb4095c8b8fd697c145273' 
  AND (
    token = '4aNKkLN+F3fgtkcAHDq0DsdJT4ZuZElCQBc79ugjRSI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046