UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J8mgbOZ7BOwz5NKmMK5UV8YZ4rqGWHTMig4A84zSwqM=' 
WHERE 
  key_id = '1671b5efb35060b914ee45fa8eb5414334afd2e1e14857406f338817f790e86c' 
  AND (
    token = 'J8mgbOZ7BOwz5NKmMK5UV8YZ4rqGWHTMig4A84zSwqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029