UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'csHMjfLukf86xKiYNT5rjibgLe2hsTUpNOnLNwra4t4=' 
WHERE 
  key_id = '8ca58b4b03fa6fd0de1eacf308db55333b50ba17b505a65a4bd2b225426ed3fb' 
  AND (
    token = 'csHMjfLukf86xKiYNT5rjibgLe2hsTUpNOnLNwra4t4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036