UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ImsyRC7OnHtUckdUyRpG3zx78fMzRBm+2b6lOipDBto=' 
WHERE 
  key_id = 'e23995cc605419dbccdce8b652b55545d31e9b7c627aabf8fb87eca3d00c12e0' 
  AND (
    token = 'ImsyRC7OnHtUckdUyRpG3zx78fMzRBm+2b6lOipDBto=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016