UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rdHKyQSVonkOD+8v51tibYgbh066EswjgJqjPUO3+4E=' 
WHERE 
  key_id = '626a44740f6c37a7f8912a85526a8aa8cda546b1545028c53f69548e7c66c893' 
  AND (
    token = 'rdHKyQSVonkOD+8v51tibYgbh066EswjgJqjPUO3+4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045