UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o1wgTHyxNQCE4OVg04jdSyc7hSPCMJXFTkvvM2gj6CY=' 
WHERE 
  key_id = 'ffbd8e0342040acc64503f14cf4889ad2d9e92a7f5b65699b7277c466abcaba8' 
  AND (
    token = 'o1wgTHyxNQCE4OVg04jdSyc7hSPCMJXFTkvvM2gj6CY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050