UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SwaOb9SK3cyaope85STDpv4AWhH2g6mQ+FK0yeVbek8=' 
WHERE 
  key_id = '1e3b3828d162ca34b75c85d05fd1688973baa4878a5c7f0136df2e7c4430026b' 
  AND (
    token = 'SwaOb9SK3cyaope85STDpv4AWhH2g6mQ+FK0yeVbek8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00168