UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mnov7TuztsWLictCSSlW5i3CUnWbDY4k7kgrG+GTxDE=' 
WHERE 
  key_id = '0ce7c9876a4e47ee5bab6dcbb7b87790ac9322bff4d3e919ce86045703555658' 
  AND (
    token = 'mnov7TuztsWLictCSSlW5i3CUnWbDY4k7kgrG+GTxDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031