UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ycaLOGqWVMfG81ueipgESS/klh8teAFAU1H/8noDVGY=' 
WHERE 
  key_id = 'e321bb477d3dcdff61647a6a321d8630e40226b563fbb71d67a2bb26c107add5' 
  AND (
    token = 'ycaLOGqWVMfG81ueipgESS/klh8teAFAU1H/8noDVGY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048