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

Query time 0.00038