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

Query time 0.00050